<!DOCTYPE html>
<html>
<?php include("head.php")?>
<?php
	function verMas($cadena,$cantidad){
		if(strlen($cadena) > $cantidad)
			return substr($cadena,0,$cantidad)."...";
		else
			return $cadena;
	}
?>
<body>
	<div class="container">
		<a class="brand" href="<?php echo base_url() ?>" name="top"><img style="margin: 6px auto" src="<?php echo base_url('application/views/img/logo.png') ?>" alt="Image" style="max-width:100%;" /></a>

<a  class="btn btn-mini pull-right"  href="<?php echo base_url('index.php/principal/') ?>">
					<i class="icon-star"></i> Ver Sistema
					</a>

		<?php include("navbar.php")?>

		<div class="btn-group">
			<a href="<?php echo base_url('index.php/adminPeliculas/agregar') ?>" class="btn btn-primary btn-large"><i class="icon-plus icon-white"></i></a>
			<a href="<?php echo base_url('index.php/adminPeliculas/agregar') ?>" class="btn btn-primary btn-large"> Nueva película</a>
		</div>
		

		<hr />
<?php if($mensaje!=NULL){?>
<div class="alert <?php echo $accion; ?>"><button type="button" class="close" data-dismiss="alert">&times;</button><?php echo $mensaje; ?></div>
<?php }?>
		<div>
			<table class="table table-striped">
			  <thead>
				<tr>
				  <th>Póster</th>
				  <th>Año</th>
				  <th>Título</th>
				  <th>Género</th>
				  <th>Sinopsis</th>
				  <th style="width: 36px;"></th>
				</tr>
			  </thead>
			  <tbody>
				<?php
				echo $this->pagination->create_links();
				for($i=0;$i<count($result);$i++){
					echo "<tr>
					  <td><img src=\"".base_url()."poster/".$result[$i]->rutaPoster."\" alt=\"Image\" style=\"width:36px;\" /></td>
					  <td>".$result[$i]->anyo."</td>
					  <td>".$result[$i]->titulo."</td>
					  <td>".$result[$i]->genero."</td>
					  <td>".verMas($result[$i]->sinopsis,45)."</td>
					  <td>
						<div class=\"btn-group\">
							<a href = \"".base_url("index.php/adminPeliculas/editar/".$result[$i]->id)."\" class=\"btn btn-success\"><i class=\"icon-pencil icon-white\"></i></a>
							<a href=\"".base_url('index.php/adminPeliculas/eliminar/'.$result[$i]->id)."\" class=\"btn btn-danger\"><i class=\"icon-remove icon-white\"></i></a>
						</div>
					  </td>
					</tr>";
				}
				?>

			  </tbody>
			</table>
		</div>
		
	<?php include("footer.php")?>
	</div>
	
	<?php include("scripts.php")?>

  </body>
</html>
	
	
